WM_4 - ALESSANDRA_SOUSA - JAVASCRIPT - WEEK 1 - #351
Conversation
jcholyhead
left a comment
There was a problem hiding this comment.
A good rule of thumb for JS "variables". Always use the const keyword, unless the variable must change later in the script. This small change will make your code look a lot more 'professional' and will make it stand out during a job application process.
| let mentor1 = "Daniel"; | ||
| let mentor2 = "Irina"; | ||
| let mentor3 = "Mimi"; | ||
| let mentor4 = "Rob"; | ||
| let mentor5 = "Yohannes"; |
There was a problem hiding this comment.
These variables don't do anything here, because you are passing the strings directly into the mentor parameter.
| function concatenate(firstWord, secondWord, thirdWord) { | ||
| // Write the body of this function to concatenate three words together. | ||
| // Look at the test case below to understand what this function is expected to return. | ||
| return word.concat(firstWord, secondWord, thirdWord); |
There was a problem hiding this comment.
I don't think this will work - what is word?
The concat function is called on a string. You can solve this exercise with this function, but it will look (something) like this:
return firstWord.concat(" ", secondWord, " ", thirdWord);
Better to use interpolation:
return `${firstWord} ${secondWord} ${thirdWord}`;
|
After trying to correct the errors. |
|
|
||
| function getStringLength(word) { | ||
| return "word".length(); | ||
| return word.length(); |
There was a problem hiding this comment.
You do not need to use () when you call length(). It should be word.length, without a function call.
Please check this: https://www.w3schools.com/jsref/jsref_length_string.asp
Volunteers: Are you marking this coursework? You can find a guide on how to mark this coursework in
HOW_TO_MARK.mdin the root of this repositoryYour Details
Homework Details
Notes
What did you find easy?
What did you find hard?
What do you still not understand?
Any other notes?
View rendered exercises/G-numbers/README.md